﻿using CeremonyBackground.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CeremonyBackground.Infrastructure.EntityConfigurations
{
    public class PrizeEntityTypeConfiguration
        : IEntityTypeConfiguration<Prize>
    {
        public void Configure(EntityTypeBuilder<Prize> builder)
        {
            builder.ToTable("Prize");

            builder.HasKey(ci => ci.Id);

            builder.Property(ci => ci.Id)
               .UseHiLo("prize_hilo")
               .IsRequired();

            builder.Property(cb => cb.PrizeName)
                .IsRequired(true)
                .HasMaxLength(100);
            builder.Property(cb => cb.ImageName)
               .IsRequired(false)
               .HasMaxLength(500);
            builder.Property(cb => cb.Scene)
                .IsRequired(true);
            builder.Property(cb => cb.Num)
               .IsRequired(true);
            builder.Property(cb => cb.Tag)
                .IsRequired(false);
            builder.Property(cb => cb.Level)
              .IsRequired(true);
            builder.Property(cb => cb.CreateTime)
               .IsRequired(true);
        }
    }
}
